package com.ruoyi.hospital.service.prescriptionInfo.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.hospital.mapper.prescriptionInfo.PrescriptionTemplateMapper;
import com.ruoyi.hospital.domain.prescriptionInfo.PrescriptionTemplate;
import com.ruoyi.hospital.service.prescriptionInfo.IPrescriptionTemplateService;

/**
 * 处方模板Service业务层处理
 * 
 * @author wendao
 * @date 2024-08-20
 */
@Service
public class PrescriptionTemplateServiceImpl implements IPrescriptionTemplateService 
{
    @Autowired
    private PrescriptionTemplateMapper prescriptionTemplateMapper;

    /**
     * 查询处方模板
     * 
     * @param id 处方模板主键
     * @return 处方模板
     */
    @Override
    public PrescriptionTemplate selectPrescriptionTemplateById(Integer id)
    {
        return prescriptionTemplateMapper.selectPrescriptionTemplateById(id);
    }

    @Override
    public PrescriptionTemplate selectPrescriptionTemplateByTemplateIdAndDocId(Integer templateId, Integer docId) {
        return prescriptionTemplateMapper.selectPrescriptionTemplateByTemplateIdAndDocId(templateId, docId);
    }

    /**
     * 查询处方模板列表
     * 
     * @param prescriptionTemplate 处方模板
     * @return 处方模板
     */
    @Override
    public List<PrescriptionTemplate> selectPrescriptionTemplateList(PrescriptionTemplate prescriptionTemplate)
    {
        return prescriptionTemplateMapper.selectPrescriptionTemplateList(prescriptionTemplate);
    }

    /**
     * 新增处方模板
     * 
     * @param prescriptionTemplate 处方模板
     * @return 结果
     */
    @Override
    public int insertPrescriptionTemplate(PrescriptionTemplate prescriptionTemplate)
    {
        prescriptionTemplate.setCreateTime(DateUtils.getNowTimeSecond());
        return prescriptionTemplateMapper.insertPrescriptionTemplate(prescriptionTemplate);
    }

    /**
     * 修改处方模板
     * 
     * @param prescriptionTemplate 处方模板
     * @return 结果
     */
    @Override
    public int updatePrescriptionTemplate(PrescriptionTemplate prescriptionTemplate)
    {
        prescriptionTemplate.setUpdateTime(DateUtils.getNowTimeSecond());
        return prescriptionTemplateMapper.updatePrescriptionTemplate(prescriptionTemplate);
    }

    /**
     * 批量删除处方模板
     * 
     * @param ids 需要删除的处方模板主键
     * @return 结果
     */
    @Override
    public int deletePrescriptionTemplateByIds(Integer[] ids)
    {
        return prescriptionTemplateMapper.deletePrescriptionTemplateByIds(ids);
    }

    /**
     * 删除处方模板信息
     * 
     * @param id 处方模板主键
     * @return 结果
     */
    @Override
    public int deletePrescriptionTemplateById(Integer id)
    {
        return prescriptionTemplateMapper.deletePrescriptionTemplateById(id);
    }
}
